﻿	function slide_btn(){
		if($(".slide_box").is(":visible")){
			$(".slide_login").slideUp();
			$(".slide_regesit").slideUp();
			
			$(".slide_box").delay(20).slideUp();
		}
		else{
			$(".slide_box").slideDown(
				function(){
					$(".slide_login").slideDown(100);
					
				}
			);

			 
		}
	};
	function show_regesit(){
		$(".slide_login").hide();
		$(".slide_regesit").show();
		
	}
	function regesit_btn(){
		if($(".slide_box").is(":visible")){
			$(".slide_login").slideUp();
			$(".slide_regesit").slideUp();
			
			$(".slide_box").delay(20).slideUp();
		}
		else{
			$(".slide_box").slideDown(
				function(){
					$(".slide_login").hide(100);
					$(".slide_regesit").slideDown(100);
					
				}
			);

			 
		}
	};
	//返回顶部
		function goTopEx(){
         var obj=document.getElementById("goTopBtn");
        function getScrollTop(){
                return document.documentElement.scrollTop;
            }
        function setScrollTop(value){
                document.documentElement.scrollTop=value;
            }    
        window.onscroll=function(){getScrollTop()>0?obj.style.display="":obj.style.display="none";}
        obj.onclick=function(){
            var goTop=setInterval(scrollMove,10);
            function scrollMove(){
                    setScrollTop(getScrollTop()/1.8);
                    if(getScrollTop()<1)clearInterval(goTop);
                }
        }
    }
	
	
	
	

	

/* 登录验证 */
function login(){

var name="\#"+"email";
var email=$(name).val();
var pass="\#"+"password";
var password=$(pass).val();
$.ajax({
url:".././public_files/login.php",
type:"POST",
data:"email="+email+"&password="+password,
cache:false,
success:function(date){

date=date.replace(/(^\s*)|(\s*$)/g, "");

 	if(date=="1"){
		alert("密码错误");
	}else if(date=="2"){
	alert("用户不存在");
	}else{
		slide_btn();
		$(".l_r_text").html(date);
		

	} 

}

});
}
/*注册*/
function register(){
var password=$("#Password").val();alert(password);
var username=$("#Username").val();
var email=$("#Email").val();

$.ajax({
url:"../public_files/register.php",

data:"password="+password+"&username="+username+"&email="+email,
type:"POST",
success:function(date){

date=date.replace(/(^\s*)|(\s*$)/g, "");

if(date=="1"){

alert("邮箱已注册");

}else if(date=="2"){

alert("注册失败");

}else{

		slide_btn();
		$(".l_r_text").html(date);
}
}
});


}
/*用户头像显示*/
function show_upload(){
		$close_or_open=$("#photo").attr("value");		
		if($close_or_open==0){
			$(".upload_photo").fadeIn(800);
			$("#photo").attr("value","1");
		}else{
			$(".upload_photo").fadeOut(800);
			$("#photo").attr("value","0");
		
		}
}


/*注销*/
function destroy(){

$.ajax({
url:"../public_files/destory.php",
dataType:"json",
success:function(){
	location.href="index.php";
}



});


}



/*遮罩层*/
function openNewDiv()
{
	
    var newMask = document.createElement("div");

     _scrollWidth = Math.max(document.body.scrollWidth,document.documentElement.scrollWidth);
    _scrollHeight = Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);

	$(newMask).css({position:'absolute',zIndex:'500',width:_scrollWidth,height:_scrollHeight,top:'0',left:'0',background:'#333',filter:'alpha(opacity=40',opacity:'0.4'})
	$(newMask).attr("id","bb")
   
	 document.body.appendChild(newMask);
	$("#list_name_input").css({left:'0',right:'0',position:'absolute',zIndex:'1000'}).show(50).animate({bottom:170});

}

function btn_close(){
		$("#list_name_input").css({display:'none'});
		$("#bb").remove();
}


